import storage from "@/utils/storage.js";
import config from '@/config/config';
// #ifndef VUE3
import Vue from 'vue'
import App from './App'

Vue.prototype.$navigateCheck = function(url, needCheck = true) {
	let hasLogin = storage.getHasLogin();
	let bindRoomStatus = storage.getBindRoom();
	if (hasLogin && hasLogin != "") {
		if(needCheck==false){
			uni.navigateTo({
				url: `${url}`
			})
			return ;
		}
		if(!bindRoomStatus&&needCheck){
			uni.showToast({
				title:"请先绑定房屋",
				duration:3000,
				icon:"none"
			});
			return ;
		}
		if(url=="/pages/login/bindRoom"&&bindRoomStatus){
			uni.showToast({
				title:"房屋已绑定",
				duration:3000,
				icon:"none"
			});
			return ;
		}
		uni.navigateTo({
			url: `${url}`
		})
		
	} else {
		console.log("yangzl");
		// #ifdef MP-WEIXIN
		uni.navigateTo({
			url: "/pages/login/wechatMPLogin",
		});
		// #endif
		// #ifndef MP-WEIXIN
		uni.navigateTo({
			url: "/pages/login/aliMPLogin",
		});
		//  #endif
	}
}

Vue.config.productionTip = false

App.mpType = 'app'

const app = new Vue({
    ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
import App from './App.vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif